Skip to content

Add structured data testing for JSON-LD validation - #151

Merged
fulldecent merged 7 commits into
mainfrom
copilot/fix-101
Aug 20, 2025
Merged

Add structured data testing for JSON-LD validation#151
fulldecent merged 7 commits into
mainfrom
copilot/fix-101

Conversation

Copilot AI commented Aug 20, 2025

Copy link
Copy Markdown
Contributor

This PR implements comprehensive structured data testing using structured-data-testing-tool to validate JSON-LD scripts in built HTML files.

Implementation

Core validation script (test/build-structured-data-validate.mjs):

  • Scans all HTML files in build/**/*.html for structured data
  • Detects JSON-LD syntax errors and schema validation failures
  • Provides clear success/failure feedback with structured data summaries
  • Integrates with existing test patterns and CI pipeline

Fixture-based testing (test/fixtures-structured-data-should-fail.mjs):

  • Tests both valid and invalid JSON-LD scenarios
  • Ensures the validator correctly identifies parsing errors like the a"@context" syntax error mentioned in the issue
  • Follows the repository's existing fixture test patterns

Package integration:

  • Added structured-data-testing-tool as a dev dependency
  • Integrated into main test chain via yarn test
  • Provides standalone yarn test-structured-data command
  • Automatically runs in CI pipeline without workflow changes
  • Fixed Yarn PnP module resolution by using yarn node instead of direct node execution

Testing Results

The implementation successfully validates structured data:

// Valid JSON-LD passes validation
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "My Website"
}

// Invalid JSON-LD (like a"@context") fails validation
{
  a"@context": "https://schema.org",  // Syntax error detected
  "@type": "WebSite"
}

The tool detects both JSON syntax errors and schema.org validation issues, providing robust structured data testing for any website built with this template.

Fixes #101.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI commented Aug 20, 2025

Copy link
Copy Markdown
Contributor Author

@fulldecent 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 3 commits August 20, 2025 01:21
Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>
Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>
Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>
Copilot AI changed the title [WIP] Add structured data testing Add structured data testing for JSON-LD validation Aug 20, 2025
Copilot AI requested a review from fulldecent August 20, 2025 01:32
@fulldecent

Copy link
Copy Markdown
Owner

@copilot build failed

Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>

Copilot AI commented Aug 20, 2025

Copy link
Copy Markdown
Contributor Author

@copilot build failed

Fixed the build failure in commit 4477152. The issue was with Yarn PnP module resolution - the scripts needed to use yarn node instead of direct node execution. The structured data testing implementation is now working correctly and all tests pass.

@fulldecent

Copy link
Copy Markdown
Owner

@copilot code linting check failed. fix that

Co-authored-by: fulldecent <382183+fulldecent@users.noreply.github.com>

Copilot AI commented Aug 20, 2025

Copy link
Copy Markdown
Contributor Author

@copilot code linting check failed. fix that

Fixed the code linting issues in commit a162a9f. The Prettier formatting has been applied to all structured data test files and linting now passes successfully.

@fulldecent
fulldecent marked this pull request as ready for review August 20, 2025 02:59
@fulldecent
fulldecent merged commit 49ee279 into main Aug 20, 2025
5 checks passed
@fulldecent
fulldecent deleted the copilot/fix-101 branch December 8, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add structured data testing

2 participants